<?php

/**
 * sekolah form base class.
 *
 * @method sekolah getObject() Returns the current form's model object
 *
 * @package    pendidikan indonesia
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BasesekolahForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                  => new sfWidgetFormInputHidden(),
      'nomor_induk_sekolah' => new sfWidgetFormInputText(),
      'id_propinsi'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('setPropinsi'), 'add_empty' => true)),
      'id_kota'             => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('setKota'), 'add_empty' => true)),
      'nama_sekolah'        => new sfWidgetFormInputText(),
      'alamat'              => new sfWidgetFormInputText(),
      'email'               => new sfWidgetFormInputText(),
      'kode_pos'            => new sfWidgetFormInputText(),
      'created_at'          => new sfWidgetFormDateTime(),
      'updated_at'          => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                  => new sfValidatorDoctrineChoice(array('model' => $this->getModelName(), 'column' => 'id', 'required' => false)),
      'nomor_induk_sekolah' => new sfValidatorString(array('max_length' => 50, 'required' => false)),
      'id_propinsi'         => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('setPropinsi'), 'required' => false)),
      'id_kota'             => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('setKota'), 'required' => false)),
      'nama_sekolah'        => new sfValidatorString(array('max_length' => 200)),
      'alamat'              => new sfValidatorPass(array('required' => false)),
      'email'               => new sfValidatorString(array('max_length' => 150, 'required' => false)),
      'kode_pos'            => new sfValidatorString(array('max_length' => 7, 'required' => false)),
      'created_at'          => new sfValidatorDateTime(),
      'updated_at'          => new sfValidatorDateTime(),
    ));

    $this->validatorSchema->setPostValidator(
      new sfValidatorDoctrineUnique(array('model' => 'sekolah', 'column' => array('email')))
    );

    $this->widgetSchema->setNameFormat('sekolah[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'sekolah';
  }

}
